<template>
  <div>
        
        <a-table :columns="columns" :data-source="data" :rowKey="(record,index)=>{return index}"  bordered>
          
          <template slot="footer" >
            常用操作&nbsp;: &nbsp;&nbsp;
            <a-button type="primary"><router-link to="/add">增加</router-link></a-button> &emsp;
            <a-button type="danger"><router-link to="/del">删除</router-link></a-button> &emsp;
            <a-button><router-link to="/putuser">修改</router-link></a-button> &emsp;
            <a-button type="dashed"><router-link to="/find">查找</router-link></a-button>
            <router-view></router-view>
          </template>　　
        </a-table>
  </div>
</template>

<script>
const columns = [
    {
      title: '用户ID',
      dataIndex: 'id',
      key: 'id',
    },
    {
      title: '用户名',
      dataIndex: 'username',
      // key: 'username',
    },
    {
      title: '密码',
      dataIndex: 'password',
      // key: 'password',
    },
];
export default {
  data () {
    return {
        collapsed: false,
        data:[],
        columns,
    };
  },
  methods: {
      getUser(){
      this.$axios.get('select/')
      .then(res=>{
        console.log(res.data);
        
        this.data=res.data
      })
    }
  },
  mounted(){
      this.getUser();
  },
}

</script>
<style>
     
</style>